INTERIOR=0;
WALL=1;
INFLOW=2;
OUTFLOW=3;
mask=INTERIOR*ones(dimP,1);

fprintf('creating mask ...\n'); %fflush(stdout);

fprintf('creating mask ...\n'); %(stdout);

for i=1:NI
    for j=1:NJ
        %%%DOMAIN BOUNDARY
        if (i == 1)
            mask(ij2n(i,j)) = INFLOW;
        end
        if (i == NI)
            mask(ij2n(i,j)) = OUTFLOW;
        end
        if ((j == 1)||(j == NJ))
            mask(ij2n(i,j)) = WALL;
        end
        %%%INTERIOR WALLS
        %xp = (i-1.5)*dx;
        %yp = (j-1.5)*dy;
        xp = Xp(i,j);
        yp = Yp(i,j);
        if ((xp < 4)&&(yp < 1))
            mask(ij2n(i,j)) = WALL;
        end
    end
end

%Mask transcription to U-,V-cells
masku=INTERIOR*ones(dimU);
maskv=INTERIOR*ones(dimV);

fprintf('transcribing mask to u,v cells ...\n'); %fflush(stdout);


for i=1:NI
    for j=1:NJ
        if (mask(ij2n(i,j)) ~= INTERIOR)
            masku(ij2nu(i,j))   = mask(ij2n(i,j));
            masku(ij2nu(i+1,j)) = mask(ij2n(i,j));
            maskv(ij2nv(i,j))   = mask(ij2n(i,j));
            maskv(ij2nv(i,j+1)) = mask(ij2n(i,j));
        end
        if (mask(ij2n(i,j)) == OUTFLOW)
            masku(ij2nu(i,j)) = INTERIOR;
        end
    end
end


